package cn.sangyy.car.service.impl;

import cn.sangyy.car.domain.CarResources;
import cn.sangyy.car.mapper.CarResourcesMapper;
import cn.sangyy.car.service.ICarResourcesService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 存放车辆资源信息的-图片,视频,音频等 服务实现类
 * </p>
 *
 * @author sangyangyang
 * @since 2023-05-26
 */
@Service
public class CarResourcesServiceImpl extends ServiceImpl<CarResourcesMapper, CarResources> implements ICarResourcesService {

    @Autowired
    private CarResourcesMapper carResourcesMapper;

    @Override
    @Transactional
    public void insertBatchCarRe(List<CarResources> carResourcesList) {
        carResourcesMapper.delete(new EntityWrapper<CarResources>()
                .eq("car_id",carResourcesList.get(0).getId()));
        carResourcesMapper.insertBatch(carResourcesList);
    }
}
